package de.gameduell.framework.gui.util {

	/**
	 * @author fsri
	 */
	public class Formatter {
		
		/*
		formats a (numeric) string (e.g."10000") to english spelling ("10,000")
		*/
		public static function formatNumberEnglish(number:String, seperator:String = ","):String {
			var arr:Array = number.split("");
			var res:String = "";
			var highestDigit:uint = arr.length % 3;
			for(var i:uint = 0;i < arr.length; i++) {
				res += arr[i] + ((i - highestDigit + 1) % 3 == 0 && i < arr.length - 1 ? seperator : "");
			}
			return res;
		}
	}
}

